import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { rules } from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import { getWeekMonthQuarterYear } from '/@/utils';
//列表数据
export const columnsA: BasicColumn[] = [
  {
    title: '卡券ID',
    align: 'center',
    dataIndex: 'id',
  },
  {
    title: '卡种名称',
    align: 'center',
    dataIndex: 'name',
  },
  {
    title: '订单信息',
    align: 'center',
    dataIndex: 'buyPrice',
    slots: { customRender: 'buyPrice' },
  },
  {
    title: '状态',
    align: 'center',
    dataIndex: '',
    slots: { customRender: 'state' },
  },
  {
    title: '上传时间',
    align: 'center',
    dataIndex: 'createTime',
  },
  {
    title: '销售时间',
    align: 'center',
    dataIndex: 'useTime',
  },
];

export const searchFormSchema: FormSchema[] = [
  {
    label: '品牌',
    field: 'brandId',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: 'app_brand,name,id',
      placeholder: '请选择品牌',
      showSearch: true,
    },
  },
  {
    label: '卡种名称',
    field: 'name',
    component: 'Input',
  },
  {
    label: '卡券ID',
    field: 'cardId',
    component: 'Input',
  },
  {
    label: '上传时间',
    field: 'createTime',
    component: 'DatePicker',
    componentProps: {
      showTime: false,
      valueFormat: 'YYYY-MM-DD',
    },
  },
  {
    label: '销售时间',
    field: 'useTime',
    component: 'DatePicker',
    componentProps: {
      showTime: false,
      valueFormat: 'YYYY-MM-DD',
    },
  },
];
//列表数据
export const columnsB: BasicColumn[] = [
  {
    title: '下级',
    align: 'center',
    dataIndex: 'nickName',
  },
  // {
  //   title: '钱包余额',
  //   align: 'center',
  //   dataIndex: 'aliNumber',
  // },
  {
    title: '累计提现',
    align: 'center',
    dataIndex: 'withdraw',
  },
  {
    title: '下级人数',
    align: 'center',
    dataIndex: 'subordinateNum',
  },
  {
    title: '绑定时间',
    align: 'center',
    dataIndex: 'inviteTime',
  },
  {
    title: '学生认证状态',
    align: 'center',
    dataIndex: 'isStudent_dictText',
  },
];
//列表数据
export const columnsC: BasicColumn[] = [
  {
    title: '变动时间',
    align: 'center',
    dataIndex: 'createTime',
  },
  {
    title: '变动金额',
    align: 'center',
    dataIndex: 'amount',
    slots: { customRender: 'amount' },
  },
  {
    title: '变动类型',
    align: 'center',
    dataIndex: 'type',
    slots: { customRender: 'type' },
  },
  {
    title: '余额',
    align: 'center',
    dataIndex: 'balance',
  },
  {
    title: '卡券id',
    align: 'center',
    dataIndex: 'sourceDesc',
  },
  {
    title: '卡种名称',
    align: 'center',
    dataIndex: 'cardTypeName',
  },
  {
    title: '备注',
    align: 'center',
    dataIndex: 'remark',
  },
];

//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '手机号',
    field: 'phone',
    component: 'Input',
    dynamicDisabled: true,
  },
  {
    label: '昵称',
    field: 'nickName',
    component: 'Input',
    dynamicDisabled: true,
  },
  {
    label: '头像',
    field: 'avatar',
    component: 'JImageUpload',
    componentProps: {
      fileMax: 1,
    },
    dynamicDisabled: true,
  },
  {
    label: '余额',
    field: 'amount',
    component: 'InputNumber',
    dynamicDisabled: true,
  },
  {
    label: '邀请码',
    field: 'inviteCode',
    component: 'Input',
    dynamicDisabled: true,
  },
  {
    label: '真实姓名',
    field: 'realName',
    component: 'Input',
    dynamicDisabled: true,
  },
  {
    label: '身份证号',
    field: 'idCard',
    component: 'Input',
    dynamicDisabled: true,
  },
  {
    label: '学生认证状态',
    field: 'isStudent',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: 'student_state',
    },
  },
  {
    label: '学号',
    field: 'studentNumber',
    component: 'Input',
    dynamicDisabled: true,
  },
  {
    label: '学生证照片',
    field: 'studentImage',
    component: 'JImageUpload',
    componentProps: {
      fileMax: 1,
    },
    dynamicDisabled: true,
  },
  {
    label: '绑定上级时间',
    field: 'inviteTime',
    component: 'DatePicker',
    componentProps: {
      showTime: true,
      valueFormat: 'YYYY-MM-DD HH:mm:ss',
    },
  },
  {
    label: '支付宝姓名',
    field: 'aliName',
    component: 'Input',
  },
  {
    label: '支付宝账号',
    field: 'aliNumber',
    component: 'Input',
  },
  // TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];

// 高级查询数据
export const superQuerySchema = {
  phone: { title: '手机号', order: 0, view: 'text', type: 'string' },
  nickName: { title: '昵称', order: 1, view: 'text', type: 'string' },
  avatar: { title: '头像', order: 2, view: 'image', type: 'string' },
  amount: { title: '余额', order: 3, view: 'number', type: 'number' },
  inviteCode: { title: '邀请码', order: 4, view: 'text', type: 'string' },
  isStudent: { title: '学生认证状态', order: 7, view: 'number', type: 'number', dictCode: 'student_state' },
  inviteTime: { title: '绑定上级时间', order: 10, view: 'datetime', type: 'string' },
  aliName: { title: '支付宝姓名', order: 11, view: 'text', type: 'string' },
  aliNumber: { title: '支付宝账号', order: 12, view: 'text', type: 'string' },
};

/**
 * 流程表单调用这个方法获取formSchema
 * @param param
 */
export function getBpmFormSchema(_formData): FormSchema[] {
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}
